package cn.tedu.product.base.config;

import cn.tedu.product.base.interceptors.AdminCheckInter;
import cn.tedu.product.base.interceptors.LoginCheckInter;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginCheckInter())
                .addPathPatterns("/v1/orders/selectOrdersUser",
                                "/v1/orders/creatOrder",
                        "/v1/users/deleteMy");

        registry.addInterceptor(new AdminCheckInter())
                .addPathPatterns("/v1/orders/selectOrdersAD",
                        "/v1/products/getStock",
                        "/v1/products/getAllStock",
                        "/v1/products/AddProduct");
    }
}
